package kamkor.webtoolseditor;

import org.apache.wicket.protocol.http.HttpSessionStore;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.session.ISessionStore;

/**
 *  
 * @see kamkor.webtoolseditor.Start#main(String[])
 */
public class WicketApplication extends WebApplication {   
	
	private static final long serialVersionUID = 1L;
	
	private boolean isProd =
        "Production".equalsIgnoreCase(
            System.getProperty("com.google.appengine.runtime.environment"));
	
	private boolean production = true;
	
    /**
     * Constructor
     */
	public WicketApplication() {	
		
	}
	
	@Override
	protected void init() {
		super.init(); 
		//remove thread monitoring from resource watcher
		this.getResourceSettings().setResourcePollFrequency(null);
		mountBookmarkablePage("/editor", HomePage.class);		
	}
	
	/**
	 * @see org.apache.wicket.Application#getHomePage()
	 */
	public Class<HomePage> getHomePage()
	{
		return HomePage.class;
	}
	
    @Override
    public String getConfigurationType() {
        //return (isProd ? "DEPLOYMENT" : "DEVELOPMENT");
        return production ? "DEPLOYMENT" : "DEVELOPMENT";
    }
    
    @Override
	protected ISessionStore newSessionStore() {	
		return new HttpSessionStore(this);
//		return new SecondLevelCacheSessionStore(this, new InMemoryPageStore());
	}

}
